#include<bits/stdc++.h>
using namespace std;
int main()
{
	unordered_map<string, int> mp;
	int n, k;
	cin>>n>>k;
	
	int x;
	string t;
	for(int i = 1;i <= n;i++)
	{
		cin>>t>>x;
		x = max(x, k);
		mp[t] += x;
	}
	cin>>n;
	for(int i = 1;i <= n;i++)
	{
		cin>>t;
		auto ii = mp.find(t);
		if(ii == mp.end())
			cout<<"No Info"<<endl;
		else if(ii->second < k)
			cout<<"No Info"<<endl;
		else
			cout<<ii->second<<endl;
	}
	return 0;
}

